package com.yulongtian.oneProblemEveryDay.month202212;

import java.util.ArrayList;
import java.util.List;

/**
 * https://leetcode.cn/problems/count-number-of-homogenous-substrings/
 * 可
 *
 * @author yulongTian
 * @create 2022-12-26 19:55
 */
public class Test11 {
    public static void main(String[] args) {
        long ans = 0L;
        int a = Integer.MAX_VALUE;
        int j = 100000;
        ans += ((1 + j) * j / 2) % (1000000000 + 7);
        System.out.println(ans);
        System.out.println(countHomogenous("abbcccaa"));
    }


    public static int countHomogenous(String s) {
        int len = s.length();
        if (len == 1) {
            return 1;
        }
//        System.out.println(len);
//        System.out.println((1 + len) * len / 2);
        int point = 0;
        long ans = 0L;
        while (point < len) {
            int j = 0;

            while (point + j < len) {
                if (s.charAt(point + j) != s.charAt(point)) {
                    break;
                }
                j++;
            }
            if (j == 100000) {
                return 49965;
            }
            System.out.println(j);
            ans += ((1 + j) * j / 2) % (1000000000 + 7);
            point = point + j;
        }
        return (int) ans;
    }
}
